package com.attendance.mapper;

import com.attendance.pojo.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 菜单映射器
 *
 * @author 鵺丶
 * @date 2021/03/14
 */
@Mapper
public interface MenuMapper extends BaseMapper<Menu> {
    /**
     * 通过父id找到菜单
     *
     * @param parentId 父id
     * @return {@link Menu}
     */
    Menu findMenuByParentId(Long parentId);

    /**
     * 通过id找到菜单
     *
     * @param id id
     * @return {@link Menu}
     */
    Menu findMenuTreeById(Long id);

    /**
     * 找到菜单树的根
     *
     * @return {@link List<Menu>}
     */
    List<Menu> findMenuTreeRoots();


    /**
     * 通过用户id找到菜单
     *
     * @param id id
     * @return {@link List<Long>}
     */
    List<Long> findMenusByUserId(Long id);

}
